const { ApolloServer, gql } = require('apollo-server')

const typeDefs = gql`
  type Query {
    sayHi: String!
  }
`

const resolvers = {
  Query: {
    sayHi: () => "hello world"
  }
}

const server = new ApolloServer({
  typeDefs,
  resolvers
})

server.listen({ port: 4001 }).then(res => {
  console.log(`Server is run on ${res.url}`)
})